import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:smart_home/router/index.dart';
import 'package:smart_home/utils/color_utils.dart';
import 'package:smart_home/widgets/common_cell.dart';
import 'package:smart_home/widgets/common_title_box.dart';
import 'package:smart_home/widgets/top_body.dart';
import '../../utils/extension/double.dart';

class ProfilePage extends StatelessWidget {
  const ProfilePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return NotLoggedIn();
  }
}

class NotLoggedIn extends StatelessWidget {
  const NotLoggedIn({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        // 改变header和appbar的横线
        elevation: 0,
        actions: [
          IconButton(
              onPressed: () {
                Get.toNamed(SETTING);
              },
              icon: Image.asset(
                "static/icons/setting.png",
                width: 24.px,
              )),
        ],
      ),
      body: Column(
        children: [
          TopBody(
            content: Column(
              mainAxisAlignment: MainAxisAlignment.end,
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                ...commonTitleBox(),
                Wrap(
                  children: [
                    Padding(
                      padding: EdgeInsets.only(top: 20.px, bottom: 10.px),
                      child: Text(
                        "如果您在已经使用过房至尊并登陆过,可直接用该房至尊官网账号进行登录。",
                        style: TextStyle(color: Colors.white, fontSize: 16.px),
                      ),
                    ),
                    Row(
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        Container(
                            margin: EdgeInsets.only(top: 20.px, bottom: 10.px),
                            width: MediaQuery.of(context).size.width * 0.85,
                            height: 50.px,
                            child: MaterialButton(
                                shape: RoundedRectangleBorder(
                                    borderRadius: BorderRadius.all(
                                        Radius.circular(30.px))),
                                onPressed: () {
                                  Get.toNamed(LOGIN);
                                },
                                child: Text("注册/登录"),
                                color: Colors.white)),
                      ],
                    ),
                  ],
                )
              ],
            ),
            height: 250.px,
          ),
          Cell(
            iconUri: "headset",
            title: "在线客服",
          ),
          Divider(
            height: 5.px,
            color: ColorsUtil.hexColor(0xcccccc),
          ),
          Cell(
            iconUri: "edit-two",
            title: "我要反馈",
          )
        ],
      ),
    );
  }
}
